Contents | Index | < Browse | Browse >
LETTERmemcmpULETTER
Compares two memory blocks.
Overview
#include <string.h>
r = memcmp(mem1,mem2,n);
int r;
const void *mem1;
const void *mem2;
size_t n;
Portability
ANSI
Description
Compares the two memory blocks "mem1" and "mem2" for "n" bytes. Similar to
other comparison routines, zero is returned if the entire memory blocks are
identical. A value smaller than zero is returned, if the first different
character in "mem1" is smaller than the corrospending character in "mem2",
and a value greater than zero is returned, if the first different character
in "mem1" is bigger than the corrospending character in "mem2".
Returns
0, if the memory blocks are identical.
>0, if "mem1" is "greater" than "mem2".
<0, if "mem1" is "smaller" than "mem2".
See also
strcmp , strncmp